<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/13
 * Time: 13:31
 */

namespace app\common\model;


use think\Model;

class WalletRecord extends Model
{
    protected $name = 'wallet_record';
    protected $append = [
        'pay_status_name',
        'type_name'
    ];

    public function user()
    {
        return $this->hasOne('User','id','user_id');
    }

    public function getPayStatusNameAttr($value,$data)
    {
        switch ($data['pay_status']){
            case 1:
                return '成功';
                break;
            case 2:
                return '待审核';
                break;
            case 3:
                return '失败';
                break;
        }
    }
    public function getTypeNameAttr($value,$data)
    {
        switch ($data['type']){
            case 1:
                return '微信充值';
                break;
            case 2:
                return '提现';
                break;
            case 3:
                return '下注';
                break;
            case 4:
                return '中奖';
                break;
            case 5:
                return '活动赠送';
                break;
            case 6:
                return '分红';
                break;
            case 7:
                return '银行转账';
                break;
            case 8:
                return '支付宝充值';
                break;
            case 9:
                return '下分';
                break;
            case 10:
                return '钱包转入余额宝';
                break;
            case 11:
                return '余额宝转入钱包';
                break;

        }
    }

}